
<div id="actionbar">
    <div class="fn-right button-group">
        <a href="{:url('mchid/add')}" class="button"><i class="iconfont icon-add_icon"></i>添加普通商户</a> 
        <a href="{:url('mchid/reg')}" class="button button-blue"><i class="iconfont icon-add_icon"></i>申请小微商户</a>
    </div>
    <div class="fn-left button-group">
        <a href="{:url('mchid/index',['types' => 0])}" class="button{if $types == 0} button-blue{/if}">全部商户</a>
        <a href="{:url('mchid/index',['types' => 1])}" class="button{if $types == 1} button-blue{/if}">已开通</a>
        <a href="{:url('mchid/index',['types' => 2])}" class="button{if $types == 2} button-blue{/if}">待提审</a>
        <a href="{:url('mchid/index',['types' => 3])}" class="button{if $types == 3} button-blue{/if}">审核中</a> 
        <a href="{:url('mchid/index',['types' => 4])}" class="button{if $types == 4} button-blue{/if}">未通过</a>
    </div>
</div>
<table class="table">
    <thead>
        <tr>
            <th class="w100 fn-tac">操作</th>
            <th class="w80 fn-tac">商户类型</th>
            <th class="w100 fn-tac">微信商户号</th>
            <th class="w160">商户简称</th>
            <th>商户全称</th>
            <th>门店地址</th>
            <th class="w120">手机号</th>
            <th class="w70 fn-tac">默认</th>
            <th class="w70 fn-tac">锁定</th>
            <th class="w90 fn-tac">删除</th>
        </tr>
    </thead>
    <tbody>
        {foreach $lists as $vo}
        <tr>
            <td class="fn-tac">
                {if $vo.is_types}
                    {if $vo.is_pass == 0}<a href="{:url('mchid/rebuild',array('id'=>$vo.id))}" class="button"><i class="iconfont icon-edit"></i> 编辑</a>
                    {else}<a href="{:url('mchid/ispass',array('id'=>$vo.id))}" class="button"><i class="iconfont icon-search_icon"></i> 预览</a>{/if}
                {else}
                    <a href="{:url('mchid/edit',array('id'=>$vo.id))}" class="button"><i class="iconfont icon-edit"></i> 编辑</a>
                {/if}
            </td>
            <td class="fn-tac">{$vo.is_types?'小微商户':'特约商户'}</td>
            <td class="fn-tac">
                {if $vo.is_types}
                    {if $vo.is_pass == 0}<span class="badge bg-red">待提审</span>
                    {elseif $vo.is_pass == 1}<span class="badge bg-blue">审核中</span>
                    {elseif $vo.is_pass == 2}{$vo.mchid}
                    {else}<span class="badge bg-yellow">未通过</span>{/if}
                {else}{$vo.mchid}{/if}
            </td>
            <td>{$vo.merchant_shortname}</a></td>
            <td>{$vo.store_name}</a></td>
            <td>{$vo.store_street}</td>
            <td>{$vo.contact_phone}</td>
            <td class="fn-tac">
                <a class="istop" url="{:url('mchid/istop',array('id'=>$vo.id))}" href="javascript:;" title="设置为默认">
                    {if $vo.is_default}<span class="badge bg-red">默认</span>{else}<span class="badge">正常</span>{/if}
                </a>
            </td>
            <td class="fn-tac">
                <a class="istop" url="{:url('mchid/islock',array('id'=>$vo.id))}" href="javascript:;" title="解锁/锁定">
                {if $vo.status}<span class="badge bg-red">锁定</span>{else}<span class="badge">正常</span>{/if}
                </a>
            </td>
            <td class="fn-tac">
                {if $vo.is_delete}
                    <a class="button button-disabled" href="javascript:;" title="删除"><i class="iconfont icon-lajixiang"></i>删除</a>
                {else}
                    <a class="button isDel" url="{:url('mchid/delStore',['id' => $vo.id])}" href="javascript:;" title="删除"><i class="iconfont icon-lajixiang"></i>删除</a>
                {/if}
            </td>
        </tr>
        {/foreach}
    </tbody>
</table>
{$lists|raw}
<script type="text/javascript">
Do('base', 'layer', function () {
    $('.isDel').isDel();
    $('.istop').click(function () {
        var url = $(this).attr("url");
        parent.layer.confirm('确认要设置默认商户',{ icon: 3,title: '友情提示' }, function (index) {
            $.getJSON(url,function (data) {
                window.location.reload();
            });
            parent.layer.close(index);
        });
    })
})
</script>